﻿using Newtonsoft.Json;
using System.ComponentModel;

namespace ToolsModel
{
    /// <summary>
    /// 返回给客户端的信息实体
    /// </summary>
    public class ResultJsonInfo<T> where T : class
    {
        /// <summary>
        /// 返回客户端数据
        /// </summary>
        [Description("返回客户端数据")]
        public T Data { get; set; } = default(T);

        /// <summary>
        /// 接口内部处理 返回码（0失败 1成功）
        /// </summary>
        [Description("接口内部处理 返回码（0失败 1成功）")]
        public int Code { get; set; } = 0;

        /// <summary>
        /// 请求接口成功/失败 
        /// </summary>
        [Description("请求接口成功/失败 ")]
        public bool Success { get; set; } = true;

        /// <summary>
        /// 返回的操作消息
        /// </summary>
        [Description("返回的操作消息")]
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string Msg { get; set; } = null;

        /// <summary>
        /// 返回的操作错误消息
        /// </summary>
        [Description("返回的操作错误消息")]
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string ErrMsg { get; set; } = null;

        /// <summary>
        /// 总的行数
        /// </summary>
        [Description("总的行数")]
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public int? MaxCount { get; set; } = null;

    }
}
